 <!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    #include("/common/include/include.html")
</head>
<body>
<style>
	.lay-body{
		margin-top: 52px;
		overflow-y: auto;
		overflow-x: unset;
	}
	.lay-header{
		position: absolute;
		top: 0px;
		width: 100%;
	}
</style>
<div class="modal-dialog" style="width:100%">
    <div class="modal-content" style="height: 100%;">
        <div class="modal-header lay-header">
            <button type="button" class="close" data-dismiss="modal" onclick="{parent.layer.closeAll();}"><i class="pci-cross pci-circle"></i></button>
            <h4 class="modal-title">选择车辆</h4>
        </div>

        <div class="modal-body lay-body">
	        <div class="col-sm-12 eq-box-sm">
	        	<div class="panel ">
				    <div class="panel-body">
				        <table id="pageTable" class="demo-add-niftycheck" data-toolbar="#del,#add"
				               data-show-refresh="true"
				               data-show-toggle="true"
				               data-show-columns="true"
				               data-sort-name="sort"
				               data-page-list="[5, 10, 20]"
				               data-page-size="5"
				               data-pagination="true" data-show-pagination-switch="true"></table>
				    </div>
				</div>
	        </div>
        </div>
    </div>
</div>
<script>
	var col = [{
	    field: 'checked',
	    checkbox : true,
	    align: 'center'
	},
	
		{
	       field: 'room_num',
	       title: '房间号',
	       align: 'center'
	   },
	   {
	       field: 'floor_num',
	       title: '楼层信息',
	       align: 'center'
	   },
	   {
	       field: 'building',
	       title: '所属楼栋',
	       align: 'center'
	   },
	   {
	       field: 'name',
	       title: '会议室名称',
	       align: 'center'
	   },
		   {
		       field: 'ifInUse',
		       title: '空闲状态',
		       align: 'center',
		       width:60,
		       formatter:function(value,row,index){
		           if(value=="1"){
		        	   return "<span style='color:red;'>已被借用</span>";
		           }else{
		        	   return "<span style='color:green;'>空闲</span>";
		           }
		       } 
		   },
		   {
		       field: 'des',
		       title: '描述信息',
		       align: 'center',
		       width:200
		   }];
	var opt = {
			method: 'get',
			   striped: true,
			   cache: false,  
			   pagination: true,   
			   sortOrder: "asc",    
			   singleSelect: true,                     // 单选checkbox
			   pageSize: 10,  
			   pageList: [10, 25, 50, 100],
			   url: ctx+"/admin/oa/apply/meetroom/selectMeetroomData",
			   queryParams : function(params) {
			       return {
			             pageNumber: (params.offset/params.limit)+1,
			             pageSize: params.limit
			           };
			   },
			   sidePagination: "server",
			   search: false,  
			   strictSearch: true,
			   idField : "id",
			   columns: col,
			   pagination:true,paginationShowPageGo: true
			}; 
		
	//表格
	function initTable(){
		$("#pageTable").bootstrapTable(opt);
		$('#pageTable').bootstrapTable('hideColumn', 'id');
	}
	function refreshTable(){
		$("#pageTable").bootstrapTable('refresh', opt);
		$('#pageTable').bootstrapTable('hideColumn', 'id');
	}

	function getSelections() {
	    return $.map($("#pageTable").bootstrapTable('getSelections'), function (row) {
	    	alert(JSON.stringify(row));
	        return row;//{"room_num":"203","des":"11111111111","floor_num":"2","name":"会议室","id":"2","building":"B座","ifInBorrow":"0","checked":true}
	    });
	}
	$(document).ready(function(){
		var clientH = document.body.clientHeight+446;
		$(".lay-body").css("height",clientH+"px");
		initTable();//初始化
		refreshTable();
	});
</script>
</body>
</html>

